package cn.com.miao.lynx.service.system.entity;

import cn.com.miao.lynx.common.base.model.BaseModel;
import lombok.*;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;

import javax.persistence.*;

/**
 * SysRole
 *
 * @title: SysRole
 * @description:
 * @author: dengmiao
 * @create: 2020-01-03 15:06
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = SysRole.TABLE_NAME)
@SQLDelete(sql = SysRole.LOGIC_DELETE_STATEMENT)
@Where(clause = "del_status = " + SysRole.DELETE_FLAG_NORMAL)
public class SysRole extends BaseModel<Long> {

    public final static String TABLE_NAME = "sys_role";

    public final static String LOGIC_DELETE_STATEMENT = "update " + TABLE_NAME + " set del_status = " + SysRole.DELETE_FLAG_DELETE + " where id = ?";

    /**
     * 角色标识
     */
    @Column(unique = true, nullable = false, columnDefinition = "varchar(255) DEFAULT '' COMMENT '角色标识'")
    private String roleCode;

    /**
     * 角色名
     */
    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT '角色名'")
    private String roleName;

    /**
     * 角色描述
     */
    @Column(columnDefinition = "varchar(255) DEFAULT NULL COMMENT '角色描述'")
    private String description;
}
